package com.zhiyu.middle.rocketmq.consumer;

/**
 * @Author: zhouliang
 * @Date: 2019/7/11 18:42
 */

import com.zhiyu.middle.rocketmq.entity.OrderPaidEvent;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

/**
 * 顺序消费消费者
 */
@Slf4j
@Service
@RocketMQMessageListener(consumeMode = ConsumeMode.ORDERLY, topic = "orderly-topic", consumerGroup = "orderly-consumer")
public class OrderlyRocketMQConsumer implements RocketMQListener<OrderPaidEvent> {

    @Override
    public void onMessage(OrderPaidEvent message) {
        log.info("orderly-topic顺序消费端接收到消息:{}", message.toString());
    }

}
